/**
 * 
 */
package vt.ruminote.fragment;

import vt.ruminote.R;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast;

/**
 * @author Jason
 *
 */
@SuppressLint("NewApi")
public class FunctionFragment extends Fragment {
    
    private FuncFragListener mFuncFListener = new FuncFragListener();
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState); 
        System.out.println("Fragment-->onCreate");
    }
    
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        System.out.println("Fragment-->onCreateView");
        View currentView = inflater.inflate(R.layout.main_funcfraglayout, container, false);
        Button btnVRM = (Button)currentView.findViewById(R.id.voiceRecord_main);
        Button btnCM = (Button)currentView.findViewById(R.id.cameraRecord_main);
        Button btnHWM = (Button)currentView.findViewById(R.id.handwriteRecord_main);
        btnVRM.setOnClickListener(mFuncFListener);
        btnCM.setOnClickListener(mFuncFListener);
        btnHWM.setOnClickListener(mFuncFListener);
        return currentView;
        //return super.onCreateView(inflater, container, savedInstanceState);
    }
    
    @Override
    public void onPause() {
        // TODO Auto-generated method stub
        super.onPause();
        System.out.println("Fragment-->onPause");
    }
    
    @Override
    public void onStop() {
        // TODO Auto-generated method stub
        super.onStop();
        System.out.println("Fragment-->onStop");
    }
    
    @Override
    public void onAttach(Activity activity) {
        // TODO Auto-generated method stub
        super.onAttach(activity);
        System.out.println("Fragment-->onAttach");
    }
    
    @Override
    public void onStart() {
        // TODO Auto-generated method stub
        super.onStart();
        System.out.println("Fragment-->onStart");
    }
    
    @Override
    public void onResume() {
        // TODO Auto-generated method stub
        super.onResume();
        System.out.println("Fragment-->onResume");
    }
    
    @Override
    public void onDestroy() {
        // TODO Auto-generated method stub
        super.onDestroy();
        System.out.println("Fragment-->onDestroy");
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onActivityCreated(savedInstanceState);
        System.out.println("Fragment-->onActivityCreted");
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        // TODO Auto-generated method stub
        super.onSaveInstanceState(outState);

    }
    
    //////////////////////////////////////////////////////
    private class FuncFragListener implements View.OnClickListener {
        
        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            switch(v.getId()) {
            case R.id.cameraRecord_main:
                Toast.makeText(FunctionFragment.this.getActivity(), "camera", Toast.LENGTH_SHORT).show();
                break;
                
            case R.id.voiceRecord_main:
                Toast.makeText(FunctionFragment.this.getActivity(), "voice", Toast.LENGTH_SHORT).show();
                break;
                
            case R.id.handwriteRecord_main:
                Toast.makeText(FunctionFragment.this.getActivity(), "handwrite", Toast.LENGTH_SHORT).show();
                break;
            }
        }
        
    }

}
